<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>插槽入门</title>
</head>
<body>

<div id="app">
  <navigation-link url="/profile">
    Your Profile
  </navigation-link>

  <hr>

  <navigation-link url="/profile">
    <!-- 添加一个 Font Awesome 图标 -->
    <span class="fa fa-user"></span>
    Your Profile
  </navigation-link>

  <hr>

  <navigation-link url="/profile">
    <!-- 添加一个图标的组件 -->
    <font-awesome-icon name="user"></font-awesome-icon>
    Your Profile
  </navigation-link>

</div>

<script src="../lib/vue.js"></script>
<script>
  Vue.component('navigation-link', {
    props: ['url'],
    template: `
      <a v-bind:href="url" class="nav-link">
        <slot></slot>
      </a>
    `
  })

  Vue.component('font-awesome-icon', {
    template: `
      <button>按钮</button>
    `
  })

  let vm = new Vue({
    el: '#app',
    data: {
      msg: 'Hello Vue'
    }
  })
</script>

</body>
</html>